package com.health.service;

import com.health.dao.HealthComboDao;
import com.health.dao.HealthDao;
import com.health.pojo.ComboForm;
import com.health.pojo.HealthAttributes;

public class ComboAddService {

    public static final int updateHealthAttributesByChekedInput = 2;
    public static final int selecthealthAttrabute = 1;


    public void dispath(int servicetype, ComboForm comboform, String id) {


        switch (servicetype) {
            case updateHealthAttributesByChekedInput: {
                updateHealthAttributesByChekedInput(id, comboform);
                break;
            }
            case selecthealthAttrabute: {
                selecthealthAttrabute(comboform);
                break;
            }

        }
    }

    public void selecthealthAttrabute(ComboForm comboForm) {

        HealthDao healthDao = new HealthDao();
        healthDao.selecthealthAttributes(comboForm);

    }

    public void addComboform(ComboForm comboForm) {
        HealthComboDao healthComboDao = new HealthComboDao();
        healthComboDao.insertByComboForm(comboForm);

    }

    public void updateHealthAttributesByChekedInput(String id, ComboForm comboForm) {
        HealthAttributes healthAttributes = comboForm.getHealthlist().get(id);
        healthAttributes.setChecked(!healthAttributes.getChecked());

    }

}
